

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model, Models.DauBep_Model, Models.MonAn_Model, Models.DonViTinh_Model, Models.TuyChon_Model, Models.KhuVuc_Model"%>
<script type="text/javascript">
    jQuery(document).ready(function() {
        if(id != null){
            clearInterval(id);
        }
    });
</script>
<script type="text/javascript">
    function keypress(e){
        //Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
        var keypressed = null;
        if (window.event)
        {
            keypressed = window.event.keyCode; //IE
        }
        else
        {
            keypressed = e.which; //NON-IE, Standard
        }
        if (keypressed < 48 || keypressed > 57 )
        { //CharCode của 0 là 48 (Theo bảng mã ASCII)
            //CharCode của 9 là 57 (Theo bảng mã ASCII)
            if (keypressed == 8 || keypressed == 127  )
            {//Phím Delete và Phím Back
                return;
            }
            return false;
        }
    }
</script>

<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'print', 'all', 'nofood', 'notice', 'notes', 'quantity', 'status', 'rightmsg', 'order', 'unit', 'food', 'table', 'area', 'timehistory', 'foodlist' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.

            String all = mdsts[0].getTenTS();
            String area = mdsts[1].getTenTS();
            String food = mdsts[2].getTenTS();
            String foodlist = mdsts[3].getTenTS();
            String nofood = mdsts[4].getTenTS();
            String notes = mdsts[5].getTenTS();
            String notice = mdsts[6].getTenTS();
            String order = mdsts[7].getTenTS();
            String print = mdsts[8].getTenTS();
            String quantity = mdsts[9].getTenTS();
            String rightmsg = mdsts[10].getTenTS();
            String status = mdsts[11].getTenTS();
            String table = mdsts[12].getTenTS();
            String timehistory = mdsts[13].getTenTS();
            String unit = mdsts[14].getTenTS();


            String msgright = notice + "/" + rightmsg;
            Vector v = (Vector) request.getAttribute("DSMA");
            Vector vkv = (Vector) request.getAttribute("DSKV");
            String makv = (String) request.getAttribute("makv");
            String tenma = (String) request.getAttribute("tenma");
            String tenban = (String) request.getAttribute("tenban");
            String tendvt = (String) request.getAttribute("tendvt");
            String soluong = (String) request.getAttribute("soluong");
            String mattma = (String) request.getAttribute("mattma");
            String count = (String) request.getAttribute("count");
            int total = 0;
%>


<form name="frmcook" id="frmcook" action="" method="Post" target="_blank">
    <div class="title">
        <%=foodlist%>            
        <a onclick="InPhieuCook()" title="<%=print%>" style="float: right; margin-top: 1px; cursor: pointer;" lang="<%=msgright%>"><img style="height: 32px; width: 32px; " alt="" src="../images/print.png"></a>        
        <div onclick="Cook3()" lang="<%=msgright%>" id="3" style="float: right;margin-top: 6px; " class="ttmacook ttmacook3" title="<%=DauBep_Model.LayTenTTMA("3", langid)%>"></div>
        <div id="hoithuc" style="float: right;margin-top: -1px; margin-right: 20px; position: relative;">
            <%  if (count.equals("0")) {%>
            <img style=" height: 28px; width: 32px; cursor: pointer; opacity: 0.4; margin-top: 3px;" alt="" src="../images/hoithuc.png">
            <%  } else {%>
            <div class = 'hoithuc' onclick='ShowHoiThuc()'><%=count%></div>
            <div id="rshoithuc">
                <%
                      Vector vDSHoiThuc = (Vector) request.getAttribute("DSHoiThuc");
                      for (int i = 0; i < vDSHoiThuc.size(); i++) {
                          Beans.DauBep bb = (Beans.DauBep) vDSHoiThuc.elementAt(i);%>
                <div class="mahoithuc"><%=bb.getTenMA()%></div>
                <div class="tthoithuc"><div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=bb.getMaCTHDT()%>" lang="<%=msgright%>" id="2" style=" float: left; margin-right: 0px; border-color: #1c1c1c; height: 20px; width: 20px;" class="ttmacook ttmacook2" title="<%=DauBep_Model.LayTenTTMA("2", langid)%>" ></div></div>
                <div onclick="BoQuaHoiThuc(this.align, this.lang)" align="<%=bb.getMaCTHDT()%>" lang="<%=msgright%>" style=" margin-right: 0px; height: 20px; width: 20px; float: left; cursor: pointer; border-top: 1px solid #959494;"><img style=" height: 20px; width: 20px; margin-top: 7px;" alt="" src="../images/del1.png"></div>
                    <%  }%>
            </div>
            <%  }%>
        </div>
        <div style="float: right;margin-top: 2px; margin-right: 20px;"><img style=" height: 30px; width: 30px; cursor: pointer; opacity: 0.3;" alt="" src="../images/chat.png"></div>
    </div>
    <div class="content">
        <table class="mytable" border="0" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th style="width: 4%;  "><%=order%></th>
                    <th style="width: 11%; ">
                        <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchNgayGioCook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=timehistory%></div>
                            <div id="sortkv1" style=" margin-right: 30px;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 10%; ">
                        <a href="#" id="titledskv2" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchKVCook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=area%></div>
                            <div id="sortkv2" style=" margin-right: 30px;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 7%; ">
                        <a href="#" id="titledskv3" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchBanCook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=table%></div>
                            <div id="sortkv3" style=" margin-right: 25px;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 16%; ">
                        <a href="#" id="titledskv4" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchMACook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=food%></div>
                            <div id="sortkv4" style=" margin-right: 60px;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 10%; ">
                        <a href="#" id="titledskv5" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchDVTCook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=unit%></div>
                            <div id="sortkv5" style=" margin-right: 15px;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 9%; ">
                        <a href="#" id="titledskv6" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchSLCook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=quantity%></div>
                            <div id="sortkv6" style=" margin-right: 20px;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 19%; ">
                        <a href="#" id="titledskv7" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" >
                            <div style="float:left"><%=notes%></div>
                        </a>
                    </th>
                    <th style=" ">
                        <a href="#" id="titledskv8" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortSearchTTCook(this.className, this.name, this.lang)">
                            <div style="float:left"><%=status%></div>
                            <div id="sortkv8" style=" margin-right: 60px;" class="down1"></div>
                        </a>
                    </th>
                </tr>
                <tr id="searchCook">
                    <th><img alt="" style=" margin-top: 2px; margin-left: 3px; margin-bottom: -7px; cursor: pointer;" lang="<%=msgright%>" src="../images/search1.png" onclick="SearchCook( this.lang)"></th>
                    <th></th>
                    <th>
                        <select class="makv" onchange="SearchCook(this.lang)"  lang="<%=msgright%>" >
                            <%
                                        if (makv.equals("all")) {%>
                            <option value="all"><%=all%></option>
                            <%
                                                                        for (int k = 0; k < vkv.size(); k++) {
                                                                            Beans.KhuVuc khuvuc = (Beans.KhuVuc) vkv.elementAt(k);%>
                            <option value="<%=khuvuc.getMaKV()%>"><%=khuvuc.getTenKV()%></option>
                            <%      }%>

                            <%  } else {%>
                            <option value="<%=makv%>"><%=Models.Ban_Model.LayTenKV(Integer.parseInt(makv), langid)%></option>
                            <%
                                                                        KhuVuc_Model kvv = new KhuVuc_Model();
                                                                        Vector vkhuvuc = new Vector();
                                                                        vkhuvuc = kvv.LayDSKVDB(Integer.parseInt(makv), langid);
                                                                        for (int i = 0; i < vkhuvuc.size(); i++) {
                                                                            Beans.KhuVuc kv = (Beans.KhuVuc) vkhuvuc.elementAt(i);%>
                            <option value="<%=kv.getMaKV()%>"><%=kv.getTenKV()%></option>
                            <%  }%>
                            <option value="all"><%=all%></option>
                            <%  }%>
                        </select>
                    </th>
                    <th><input value="<%=tenban%>" type="textbox" style="width: 50px;" class="text tenban"  onkeypress="return keypress(event)"></th>
                    <th><input value="<%=tenma%>" type="textbox" style="width: 130px;" class="text tenma" ></th>
                    <th><input value="<%=tendvt%>" type="textbox" style="width: 90px;" class="text tendvt" ></th>
                    <th><input value="<%=soluong%>" type="textbox" style="width: 50px;" class="text soluong" onkeypress="return keypress(event)"></th>
                    <th></th>
                    <th>
                        <select class="mattma" onchange="SearchCook(this.lang)"  lang="<%=msgright%>" >
                            <%
                                        if (mattma.equals("1")) {%>
                            <option value="1"><%=DauBep_Model.LayTenTTMA("1", langid)%></option>
                            <option value="2"><%=DauBep_Model.LayTenTTMA("2", langid)%></option>
                            <option value="3"><%=DauBep_Model.LayTenTTMA("3", langid)%></option>
                            <option value="all"><%=all%></option>
                            <%    } else if (mattma.equals("2")) {%>
                            <option value="2"><%=DauBep_Model.LayTenTTMA("2", langid)%></option>
                            <option value="1"><%=DauBep_Model.LayTenTTMA("1", langid)%></option>
                            <option value="3"><%=DauBep_Model.LayTenTTMA("3", langid)%></option>
                            <option value="all"><%=all%></option>
                            <%  } else if (mattma.equals("3")) {%>
                            <option value="3"><%=DauBep_Model.LayTenTTMA("3", langid)%></option>
                            <option value="2"><%=DauBep_Model.LayTenTTMA("2", langid)%></option>
                            <option value="1"><%=DauBep_Model.LayTenTTMA("1", langid)%></option>
                            <option value="all"><%=all%></option>
                            <%  } else {%>
                            <option value="all"><%=all%></option>
                            <option value="1"><%=DauBep_Model.LayTenTTMA("1", langid)%></option>
                            <option value="2"><%=DauBep_Model.LayTenTTMA("2", langid)%></option>
                            <option value="3"><%=DauBep_Model.LayTenTTMA("3", langid)%></option>
                            <%    }
                            %>
                        </select>
                    </th>
                </tr>
            </thead>
            <tbody>
                <%
                            for (int i = 0; i < v.size(); i++) {
                                Beans.DauBep b = (Beans.DauBep) v.elementAt(i);
                                total = total + 1;
                %>
                <tr>
                    <td><input type="checkbox" name="chkcook" value="<%=b.getMaMA()%>" alt="<%=b.getSoLuong()%>" id="<%=b.getMaDVT()%>" lang="<%=b.getGhiChu()%>"></td>
                    <td><%=b.getNgayGio()%></td>
                    <td><%=b.getTenKV()%></td>
                    <td><%=b.getTenBan()%></td>
                    <td><%=b.getTenMA()%></td>
                    <td><%=b.getTenDVT()%></td>
                    <td><%=b.getSoLuong()%></td>
                    <td style="padding-right: 5px;"><%=b.getGhiChu()%></td>
                    <td>
                        <%  if (b.getMaTTMA() == 1 || b.getMaTTMA() == 4) {%>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="1" class="ttmacook ttmacook1"  title="<%=DauBep_Model.LayTenTTMA("1", langid)%>" ></div>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="2" style="  opacity: 0.3;" class="ttmacook ttmacook2" title="<%=DauBep_Model.LayTenTTMA("2", langid)%>" ></div>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="3" style=" opacity: 0.3;" class="ttmacook ttmacook3"  title="<%=DauBep_Model.LayTenTTMA("3", langid)%>" ></div>
                        <%  if (b.getCoPhucVu() == 1) {%>
                        <div onclick="UpdateTTCook(0, this.id, this.lang, this.align)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="<%=b.getMaMA()%>" class="ttmacook" style="opacity: 0.30; margin-right: 0;"><img alt="" style="height: 18px; width: 18px; margin-top: 3px;" src="../images/del1.png"></div>
                            <%  } else {%>
                        <div onclick="UpdateTTCook(1, this.id, this.lang, this.align)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="<%=b.getMaMA()%>" class="ttmacook" style=" margin-right: 0;"><img alt="" style="height: 18px; width: 18px; margin-top: 3px;" src="../images/del1.png"></div>
                            <%}%>
                            <%  } else if (b.getMaTTMA() == 2) {%>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="1"  style=" opacity: 0.30;" class="ttmacook ttmacook1" title="<%=DauBep_Model.LayTenTTMA("1", langid)%>" ></div>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="2"  style="opacity:1; " class="ttmacook ttmacook2" title="<%=DauBep_Model.LayTenTTMA("2", langid)%>" ></div>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="3" style="opacity: 0.30;" class="ttmacook ttmacook3"  title="<%=DauBep_Model.LayTenTTMA("3", langid)%>" ></div>
                        <%} else {%>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="1"  style=" opacity: 0.30;" class="ttmacook ttmacook1" title="<%=DauBep_Model.LayTenTTMA("1", langid)%>" ></div>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="2"  style="opacity:0.3; " class="ttmacook ttmacook2" title="<%=DauBep_Model.LayTenTTMA("2", langid)%>" ></div>
                        <div onclick="UpdateTTMACook(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="3" style="opacity: 1;" class="ttmacook ttmacook3"  title="<%=DauBep_Model.LayTenTTMA("3", langid)%>" ></div>
                        <%}%>
                    </td>
                </tr>
                <%}%>
            <input type="hidden" value="<%=total%>" id="total">
            </tbody>
        </table>    
    </div>
</form>

